﻿using SY.BasicData.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SY.BasicData.Api.Read.Applications.Slaughter.Command;
using SY.BasicData.Domain.SlaughterInformation;

namespace SY.BasicData.Api.Read.Controllers.Slaughter
{
    /// <summary>
    /// 屠宰信息表
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SlaughterController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ILogger<SlaughterController> logger;

        public SlaughterController(IMediator mediator, ILogger<SlaughterController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }

        /// <summary>
        /// 屠宰信息详情
        /// </summary>
        /// <param name="command">查询命令</param>
        /// <returns>屠宰信息</returns>
        [HttpGet]
        public Task<ApiResult<SlaughterModel>> SlaughterDetail([FromQuery] GetSlaughterCommand command)
        {
            return mediator.Send(command);
        }
        /// <summary>
        /// 屠宰企业信息明细
        /// </summary>
        /// <param name="command">查询命令</param>
        /// <returns>屠宰信息</returns>
        [HttpGet]
        public Task<ApiResult<SlaughterCommpanyModel>> SlaughterCommpanyDetail([FromQuery] SlaughterQueryCommand command)
        {
            return  mediator.Send(command);

        }
    }
}
